Repository navigation
feat(artifacts): infinite canvas, arrangement and annotations - #5346
Merged
Merged
Conversation
Owner
Author
|
This change is part of the following stack: Change managed by git-spice. |
Contributor
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This was referenced Nov 27, 2026
shepherdjerred
force-pushed
the
artifacts-review
branch
5 times, most recently
from
November 28, 2026 02:08
f410085 to
2b6b508
Compare
Why
M2 needs the board to open as a free canvas an agent publish can land on.
The grid was a placeholder body in `BoardPage` for exactly this.
What
- Hand-rolled DOM canvas modelled on Claude's design canvas. The world layer
is `translate(x, y) scale(s)` (origin 0 0, s 0.05 to 4); chips, the
selection ring, the Exit chip, pins and the toolbar are an unscaled overlay
that follows the camera. The camera is a plain object written once per rAF;
React hears about it on settle (120 ms pan, 250 ms zoom). `will-change` is
set only while the camera moves.
- Input: non-passive wheel (Ctrl/Meta zooms at the cursor), Safari gesture
events and a two-pointer pinch arbitrated so one pinch applies once,
Space-, middle- and H-drag pan, a pan blanket during drags, and wheel and
gesture input a live frame forwards over the bridge. `1` fit all, `2` fit
selection, `0` 100 %; the camera is stored per board.
- Frames come from the index at world pixels. Three tiers: one live frame
(double-click or Enter, Exit chip and Esc), at most 8 inert previews (4 in
Firefox, lowered by 2 when the rAF p95 over the last 2 s of motion is over
25 ms, floor 3, with eviction hysteresis) and the typed placeholder.
Stacking is CSS z-index from `order`; iframes are never moved or remounted.
- Board pins (`board{page,x,y}`) and frame pins (via the existing
`AnchorAdapter`s) sit on the overlay. The sidebar lists all board threads.
- The outline stays the keyboard path; its link is the first tab stop and the
frame chips follow in reading order.
- The grid is removed; `?view=canvas` skips a launch redirect.
Verification
- bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts
- bun run test:e2e in packages/artifacts: desktop Chromium, mobile Chromium
and WebKit, including the canvas spec (zoom-at-cursor within 1 px, zero
iframe document requests on select, live toggle and a new frame, pins, axe,
reduced motion).
- Not run: real trackpad, iPad and Safari gestures (synthetic events only);
Firefox (cap lowered by user agent, not exercised).
Supersedes #5260.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why M2 done-when: layout survives a reload, and an agent publish during a drag loses neither change. What - Select (click, Shift-click, marquee on empty canvas), drag with a 4 px threshold, pointer capture and edge auto-pan, eight resize handles (a fixed-viewport frame keeps its aspect, a responsive one resizes freely), 8 px grid snap (Alt disables), `[` `]` z-order, arrow nudge (Shift 10x), Delete from board behind a confirm (never the artifact), undo and redo (Mod+Z, Shift+Mod+Z) over the applied ops. Esc cancels a drag. - The arrangement is a replicated document: the server's index plus an outbox of `boards.applyOps` ops, drawn as the index with the outbox applied on top. Saves are debounced 400 ms and flushed on `pagehide` (a keepalive request). A change from another actor merges by id, never moves the camera and never disturbs a drag in progress (the draft is drawn over the document). A toast names a new frame, with a jump-to. - Undo entries record before and after for the touched frames and replay as ops against the board as it is now, so another actor's frames are left alone. - `aria-live` announcements for moves, resizes, order and removal. - Dialog: a native `close` event from our own `close()` no longer closes a dialog reopened in between. Verification - bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts - bunx turbo run test:extended --filter=@shepherdjerred/artifacts - bun run test:e2e: desktop Chromium, mobile Chromium and WebKit, including the arrange spec (drag, snap, Alt, reload persistence, aspect and free resize, agent publish mid-drag, undo and redo, nudge, z-order, delete and undo, pagehide flush, edge auto-pan, Esc cancel, axe). - Not run: real trackpad and iPad gestures. Folded in (from the same PR), each with its own Why/What/Verification in the original history: - feat(artifacts): resize a frame through moveFrames: `moveFrames` entries take optional `w` and `h` (omitted leaves the size alone); the domain merge and the e2e fake apply them, so a resize merges under the row lock like a drag. - feat(artifacts): speech-bubble comment cursor and pins - feat(artifacts): restyle the canvas toolbar as a floating pill (V, H, C tool pill; zoom in its own pill; `useToolModes`) - feat(artifacts): MessageCircle cursor and pins, floating comments panel and nav pill (Shift+C panel, full-bleed canvas and focused view, floating nav pill) Supersedes #5273. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why M3: Jerred arranges and annotates; agents change content. Annotations persist in the board index and agents read them back. What - Tool pill group 2: text (T), sticky (S), pen (P), box (B), arrow (A), line (L). A drag draws (a click makes a title or a default sticky), the tool reverts to select after one shape unless Shift is held, Shift snaps lines to 45 degrees. - Notes render in the world layer (so they stay sharp; `will-change` only while the camera moves): a div for sticky, title and box, one `<svg>` per straight segment and one path per pen stroke. They never take a pointer; `shapes.ts` hit-tests geometry (a 12 screen-pixel stroke for lines, arrows and strokes, borders only for boxes) and the topmost of a note and a frame by `order` wins. - Text is edited in an overlay `<textarea>` placed through the camera (Enter or double-click; Ctrl/Cmd+Enter saves, Esc abandons; an empty new note is dropped). A palette sets colours and a title's size. - Pen strokes are simplified (Ramer-Douglas-Peucker, tolerance grown until the stroke fits the 500-point cap). - Select, move, resize (box and sticky handles, line and arrow endpoint handles), z-order, delete and undo use the arrangement machinery: history entries now cover notes and replay as `putNote` and `deleteNote`; adjacent puts of one note coalesce. - The outline lists the text of stickies and titles. - Canvas split: the overlay is `CanvasOverlay`, tool modes `useToolModes`. - The zoom pill moves above the tools in a narrow canvas (container query). Verification - bunx turbo run build typecheck test lint test:extended --filter=@shepherdjerred/artifacts - bun run test:e2e: desktop Chromium, mobile Chromium and WebKit (177 tests), including the notes spec: every kind drawn, tool reverts, Shift lock, typed text and dropped empties, edit and undo, hit testing (6 px hit, 12 px miss, box middle ignored), move, resize and endpoint drag, delete and undo and redo, colour, z-order, reload persistence, an agent's putNote arriving live, sharpness (will-change auto at rest) and axe. Folded in (from the same PR): - feat(artifacts): a pen note on the board index: `NoteSchema` gains `pen` (origin, offset points, 2 to 500 points via `MAX_PEN_POINTS`, colour); the note schema and board primitives move into `notes.ts` and `board-primitives.ts` to keep `contract.ts` under the file-size limit. Supersedes #5286. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why - The canvas adds a ThemeToggle use that console-ui deprecated and pushes FrameViewer over the cognitive-complexity limit. What - floating-nav uses ThemeButton, like the app header. - FrameViewer reads which controls to draw from one small function. Verification - bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts: pass. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
Why - The console-ui conformance scan (#5438) now covers artifacts; the canvas styles added 1 inline-typography, 9 colour-literal and 1 shared-class-patch finding, and the allowlist may only shrink. What - Shadows use var(--ui-shadow-menu) instead of colour-mix on black. - A title note passes its size as a --ar-title-font custom property. - The narrow floating nav no longer restyles .ui-workspace-label, which already ellipsizes. Verification - vitest run src/client/conformance.test.ts: pass with no allowlist change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT
shepherdjerred
force-pushed
the
artifacts-infinite-canvas
branch
from
November 28, 2026 17:30
58b6518 to
c3c48e9
Compare
shepherdjerred
marked this pull request as ready for review
November 28, 2026 17:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #5260, #5273 and #5286. Stacked on the artifacts review service PR (#5331), not on activation (#5342): the canvas is client-side UI and board-index contract work that does not need the service deployed.
Why
M2 and M3 of the review UI: the board opens as a free infinite canvas an agent publish can land on, Jerred arranges frames and comments in a floating shell, and annotates the board (text, sticky, pen, box, arrow, line) with the notes persisted in the board index so agents read them back (
toolkit artifacts show --jsonalready printsindex.notes, and it parses through the contract, which now knowspen).What
One commit per superseded PR, on #5331:
boards.applyOpsops; the contract changemoveFramestakes optionalwandh; the MessageCircle comment cursor and pins; the floating tool pill; the floating, collapsible comments panel; the floating nav pill.pennote (origin plus up to 500 offset points;notes.tsandboard-primitives.tssplit out ofcontract.ts), the T, S, P, B, A, L tools, notes rendered in the world layer with geometry hit-testing, text editing, palette, undo over notes, and the outline listing sticky and title text.Changes beyond a straight replay of the three PRs (the canvas branches were built on the pre-final UI, and the gates on
mainare stricter than they were):@base-ui/reactis a dependency of@shepherdjerred/artifactsagain (bun.lockregenerated): the floating nav menu imports it, and the UI PR's knip fix had removed it while nothing used it.BoardDatais exported fromclient/data/api.tsagain (the canvas imports it; the same knip fix had removed it)..tsxfor this package (the UI PR'sknip.jsonchange), which surfaced dead exports in the canvas code that the old config could not see:Note(shared/notes.ts),NoteKind,clampSizeandentryForwardare removed.useFollowRectincanvas/follow.tsreplaces three copies of the "size and place over a world rectangle" callback,useHandleDraginarrange/handles.tsxreplaces two copies of the pointer handlers,arrange/fixtures.tsholds the frame ids and board the arrange tests copied, andcanvas-helpers.tsgainsFIXED_CAMERA,openBoardAtFixedCameraandexpectNoAxeViolationsfor the four e2e specs that copied them.quality-ratchet(baseline untouched):shell.spec.tsusedtest.skip(isMobile, ...)nine times, which the ratchet counts as unconditional skips. Those tests are tagged@desktopor@phoneand the Playwright projects usegrepInvert, so each runs exactly where it applies and none is skipped (206 e2e tests pass, none reported skipped).Demo
Infinite canvas (#5260)
Before (grid) and after (canvas), same board:
Zoomed in on a selected frame with its pin, and the live frame (WebKit) with the Exit chip:
Settled sharpness at 200 % (WebKit) and fit-all at 50 % on the seeded demo board (Chromium):
Recording of pan, zoom at the cursor, fit, select, activate and exit: canvas-tour.webm
Arrange, shell and comment cursor (#5273)
Floating shell: canvas with the panel open, collapsed (full width again, the pill shows the count), the focused view, and a phone (pill above the tools, then the bottom sheet). For the before, compare the earlier shots below (full-width bars and a sidebar column):
MessageCircle cursor (rendered at 4x) beside the pins and the toolbar icon it comes from:
Toolbar (select, comment and hand active):
Speech-bubble cursor (Playwright cannot capture the OS cursor, so it is rendered at 4x) next to placed pins, then a recording of placing a pin in comment mode:
comment-place.webm
Re-captured: fit-all with filled and dashed (approximate) pins, and the selected frame with one ring, plus keyboard focus on a chip:
Marquee select, the selected frame with its eight handles, and an agent publish arriving mid-drag (the dragged frame stays under the pointer, a toast names the new frame, the camera does not move):
Recording of arranging a board, an agent publish arriving mid-drag, resize, undo, redo and z-order: arrange-tour.webm
Annotations (#5286)
A board with two concepts annotated: a title, a sticky with a colour, a box, an arrow, a pen stroke; the palette with the sticky selected; and an agent's
putNotearriving live:Recording: annotations-tour2.webm (draws each kind, edits text, moves, undoes and redoes, then an agent note appears).
Verification
Local evidence on the exact head; CI, publication, deployment and runtime are not claimed.
bun install --frozen-lockfileandbunx turbo run generateleave no diff.bunx turbo run build typecheck test lint --filter=@shepherdjerred/artifacts: green, 440 unit tests. The first pass of the same command with the toolkit, root-scripts and ops-model also built, type-checked and linted clean;git-spice/branch-create.test.tstimed out under the parallel run and passes alone (5/5), as onmain.bunx turbo run test:extended --filter=@shepherdjerred/artifacts --filter=@shepherdjerred/toolkit: 71 PostgreSQL tests (every note kind round-trips throughboards.get; a 501-point stroke is a 400) and the toolkitartifacts-contracttest pass.bun run test:e2einpackages/artifacts: 206 passed on desktop Chromium, mobile Chromium and WebKit (canvas, arrange, comment, notes and shell specs, axe), none skipped.bun scripts/tools/knip.tsclean;bun run jscpdbaseline ratchet passed;bun run quality-ratchetpassed;bun run check-service-registrationcomplete; root Turbo set (//#knip //#compliance-check //#check-test-standardization //#check-directory-file-counts //#check-floating-deps //#lockfile-check //#markdownlint //#hadolint //#quality-ratchet) 22/22.bunx lefthook run pre-commitover the full diff against feat(artifacts): the artifacts review service — server, UI and CLI (prepared, inactive) #5331's branch passes.docker build --target smoke -f packages/artifacts/Dockerfile .from a clean export of the branch: exit 0.🤖 Generated with Claude Code
https://claude.ai/code/session_011u9pQkmfQzZFyzPbpimoiT